<!DOCTYPE html>
<html lang="zh-CN">
  <head>
  <meta charset="UTF-8">
  <meta 
    name="viewport"
    content="width=device-width, initial-scale=1.0, minimum-scale=1.0">
  <meta 
    http-equiv="X-UA-Compatible" 
    content="ie=edge">
  <meta 
    name="theme-color" 
    content="#fff" 
    id="theme-color">
  <meta 
    name="description" 
    content="霜序廿的个人网站">
  <link 
    rel="icon" 
    href="https://api2.mubu.com/v3/photo/654b368e-b847-4122-982c-86d90b3f5275.jpg">
  <title>ACM-ICPC 2020 线下新生选拔赛第一场</title>
  
    
      <meta 
        property="og:title" 
        content="ACM-ICPC 2020 线下新生选拔赛第一场">
    
    
      <meta 
        property="og:url" 
        content="https://shuangxunian.github.io/2021/06/13/SAUACMICPCTheFirstSessionOfOfflineFreshmanSelection/index.html">
    
    
      <meta 
        property="og:img" 
        content="https://api2.mubu.com/v3/photo/654b368e-b847-4122-982c-86d90b3f5275.jpg">
    
    
      <meta 
        property="og:img" 
        content="SAU ACM-ICPC 2020 线下新生选拔赛第一场">
    
    
      <meta 
        property="og:type" 
        content="article">
      <meta 
        property="og:article:published_time" 
        content="2021-06-13">
      <meta 
        property="og:article:modified_time" 
        content="2020-12-03">
      <meta 
        property="og:article:author" 
        content="霜序廿">
      
        
          <meta 
            property="og:article:tag" 
            content="算法">
        
      
    
  
  <script>
    function loadScript(url, cb) {
      var script = document.createElement('script');
      script.src = url;
      if (cb) script.onload = cb;
      script.async = true;
      document.body.appendChild(script);
    }
    function loadCSS(href, data, attr) {
      var sheet = document.createElement('link');
      sheet.ref = 'stylesheet';
      sheet.href = href;
      sheet.dataset[data] = attr;
      document.head.appendChild(sheet);
    }
    function changeCSS(cssFile, data, attr) {
      var oldlink = document.querySelector(data);
      var newlink = document.createElement("link");
      newlink.setAttribute("rel", "stylesheet");
      newlink.setAttribute("href", cssFile);
      newlink.dataset.prism = attr;
      document.head.replaceChild(newlink, oldlink);
    }
  </script>
  
    
      
      
      
      
        
        
        
        <script>
          function prismThemeChange() {
            if(document.getElementById('theme-color').dataset.mode === 'dark') {
              if(document.querySelector('[data-prism]')) {
                changeCSS('/js/lib/prism/prism-tomorrow.min.css', '[data-prism]', 'prism-tomorrow');
              } else {
                loadCSS('/js/lib/prism/prism-tomorrow.min.css', 'prism', 'prism-tomorrow');
              }
            } else {
              if(document.querySelector('[data-prism]')) {
                changeCSS('/js/lib/prism/prism.min.css', '[data-prism]', 'prism');
              } else {
                loadCSS('/js/lib/prism/prism.min.css', 'prism', 'prism');
              }
            }
          }
          prismThemeChange()
        </script>
      
      
        
        <link rel="stylesheet" href="/js/lib/prism/prism-line-numbers.min.css">
      
    
  
  <script>
    // control reverse button
    var reverseDarkList = {
      dark: 'light',
      light: 'dark'
    };
    var themeColor = {
      dark: '#1c1c1e',
      light: '#fff'
    }
    // get the data of css prefers-color-scheme
    var getCssMediaQuery = function() {
      return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
    };
    // reverse current darkmode setting function
    var reverseDarkModeSetting = function() {
      var setting = localStorage.getItem('user-color-scheme');
      if(reverseDarkList[setting]) {
        setting = reverseDarkList[setting];
      } else if(setting === null) {
        setting = reverseDarkList[getCssMediaQuery()];
      } else {
        return;
      }
      localStorage.setItem('user-color-scheme', setting);
      return setting;
    };
    // apply current darkmode setting
  </script>
  
    <script>
      var setDarkmode = function(mode) {
      var setting = mode || localStorage.getItem('user-color-scheme');
      if(setting === getCssMediaQuery()) {
        document.documentElement.removeAttribute('data-user-color-scheme');
        localStorage.removeItem('user-color-scheme');
        document.getElementById('theme-color').content = themeColor[setting];
        document.getElementById('theme-color').dataset.mode = setting;
        prismThemeChange();
      } else if(reverseDarkList[setting]) {
        document.documentElement.setAttribute('data-user-color-scheme', setting);
        document.getElementById('theme-color').content = themeColor[setting];
        document.getElementById('theme-color').dataset.mode = setting;
        prismThemeChange();
      } else {
        document.documentElement.removeAttribute('data-user-color-scheme');
        localStorage.removeItem('user-color-scheme');
        document.getElementById('theme-color').content = themeColor[getCssMediaQuery()];
        document.getElementById('theme-color').dataset.mode = getCssMediaQuery();
        prismThemeChange();
      }
    };
    setDarkmode();
    </script>
  
  
  <link rel="preload" href="//at.alicdn.com/t/font_1946621_i1kgafibvw.css" as="style" >
  <link rel="preload" href="//at.alicdn.com/t/font_1952792_89b4ac4k4up.css" as="style" >
  
  
    <link rel="preload" href="/js/lib/lightbox/baguetteBox.min.js" as="script">
    <link rel="preload" href="/js/lib/lightbox/baguetteBox.min.css" as="style" >
  
  
    <link rel="preload" href="/js/lib/lozad.min.js" as="script">
  
  
  
  
  
  
  
  <link rel="stylesheet" href="/css/main.css">
  
  <link rel="stylesheet" href="//at.alicdn.com/t/font_1946621_i1kgafibvw.css">
  
  <link rel="stylesheet" href="//at.alicdn.com/t/font_1952792_89b4ac4k4up.css">
  
    <link rel="stylesheet" href="/js/lib/lightbox/baguetteBox.min.css">
  
<meta name="generator" content="Hexo 5.4.0"></head>

  <body>
    <div class="wrapper">
       
      <nav class="navbar">
  <div class="navbar-logo">
    <span class="navbar-logo-main">
      
        <img 
          class="navbar-logo-img" 
          src="https://api2.mubu.com/v3/photo/654b368e-b847-4122-982c-86d90b3f5275.jpg" 
          alt="blog logo">
      
      <span class="navbar-logo-dsc">霜序廿的个人网站</span>
    </span>
  </div>
  <div class="navbar-menu">
    
      <a 
        href="/" 
        class="navbar-menu-item">
        
          首页
        
      </a>
    
      <a 
        href="/archives" 
        class="navbar-menu-item">
        
          归档
        
      </a>
    
      <a 
        href="/tags" 
        class="navbar-menu-item">
        
          标签
        
      </a>
    
      <a 
        href="/categories" 
        class="navbar-menu-item">
        
          分类
        
      </a>
    
      <a 
        href="/about" 
        class="navbar-menu-item">
        
          关于
        
      </a>
    
      <a 
        href="/links" 
        class="navbar-menu-item">
        
          友链
        
      </a>
    
    <a 
      class="navbar-menu-item darknavbar" 
      id="dark">
      <i class="iconfont icon-weather"></i>
    </a>
    <a 
      class="navbar-menu-item searchnavbar" 
      id="search">
      <i 
        class="iconfont icon-search" 
        style="font-size: 1.2rem; font-weight: 400;">
      </i>
    </a>
  </div>
</nav> 
      
      <div 
        id="local-search" 
        style="display: none">
        <input
          class="navbar-menu-item"
          id="search-input"
          placeholder="请输入搜索内容..." />
        <div id="search-content"></div>
      </div>
      
      <div class="section-wrap">
        <div class="container">
          <div class="columns">
            <main class="main-column">
<article class="card card-content">
  <header>
    <h1 class="post-title">
      ACM-ICPC 2020 线下新生选拔赛第一场
    </h1>
  </header>
  <div class="post-meta post-show-meta">
    <time datetime="2021-06-13T13:48:56.242Z">
      <i 
        class="iconfont icon-calendar" 
        style="margin-right: 2px;">
      </i>
      <span>2021-06-13</span>
    </time>
    
      <span class="dot"></span>
      
        <a 
          href="/categories/%E7%AE%97%E6%B3%95/" 
          class="post-meta-link">
          算法
        </a>
      
    
    
      <span class="dot"></span>
      <span>3.1k 字</span>
    
  </div>
  
    <div 
      class="post-meta post-show-meta" 
      style="margin-top: -10px;">
      <div style="display: flex; align-items: center;">
        <i 
          class="iconfont icon-biaoqian" 
          style="margin-right: 2px; font-size: 1.15rem;">
        </i>
        
          
          <a 
            href="/tags/%E7%AE%97%E6%B3%95/" 
            class="post-meta-link">
            算法
          </a>
        
      </div>
    </div>
  
  </header>
  <div 
    id="section" 
    class="post-content">
    <h2 id="前言"><a href="#前言" class="headerlink" title="前言"></a>前言</h2><p>此篇是我自己对SAU ACM-ICPC 2020 线下新生选拔赛第一场的题的理解，不代表是正确的题解，本文中不按题目顺序，按难易程度来</p>
<h2 id="ACM-make-it-possible"><a href="#ACM-make-it-possible" class="headerlink" title="ACM, make it possible!"></a>ACM, make it possible!</h2><p><strong>题目描述</strong><br>废话，不用看</p>
<p><strong>输入格式</strong><br>无</p>
<p><strong>输出格式</strong><br>ACM, make it possible!</p>
<p><strong>思路</strong><br>求求了，这种打印东西的题，一定要复制qaq</p>
<p><strong>code</strong></p>
<pre class="line-numbers language-cpp" data-language="cpp"><code class="language-cpp"><span class="token keyword">int</span> <span class="token function">main</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">&#123;</span>
    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"ACM, make it possible!"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">&#125;</span><span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span></span></code></pre>

<h2 id="成为想要成为的猫"><a href="#成为想要成为的猫" class="headerlink" title="成为想要成为的猫"></a>成为想要成为的猫</h2><p><strong>题目描述</strong><br>有一只猫猫在看一个数字，当然猫猫看不懂人类的数字，这串数字要你来解答。<br>如果一个非零的个位数（不包括未出现的数字）在一个数字中出现的次数是它本身的倍数，那么这个个位数就是猫猫的幸运数字。<br>现在给出一个数字，请按  至  的顺序输出这个数字中出现的所有幸运数字。</p>
<p><strong>输入格式</strong><br>一个数字n(1&lt;=n&lt;=10^100)。</p>
<p><strong>输出格式</strong><br>所有的幸运数字。</p>
<p><strong>思路</strong><br>数字这么大肯定就字符串读入，然后对每个字符<code>-&#39;0&#39;</code>，变成数字，到对应的数组里面值+1，最后取个余看看是不是等于0就行。</p>
<p><strong>code</strong></p>
<pre class="line-numbers language-cpp" data-language="cpp"><code class="language-cpp"><span class="token keyword">int</span> t<span class="token punctuation">[</span><span class="token number">15</span><span class="token punctuation">]</span><span class="token punctuation">;</span>
<span class="token keyword">int</span> <span class="token function">main</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
<span class="token punctuation">&#123;</span>
   <span class="token keyword">char</span> s<span class="token punctuation">[</span><span class="token number">105</span><span class="token punctuation">]</span><span class="token punctuation">;</span>
   
   cin<span class="token operator">>></span>s<span class="token punctuation">;</span>
   <span class="token keyword">int</span> len<span class="token operator">=</span><span class="token function">strlen</span><span class="token punctuation">(</span>s<span class="token punctuation">)</span><span class="token punctuation">;</span>
   <span class="token keyword">for</span><span class="token punctuation">(</span><span class="token keyword">int</span> i<span class="token operator">=</span><span class="token number">0</span><span class="token punctuation">;</span>i<span class="token operator">&lt;</span>len<span class="token punctuation">;</span>i<span class="token operator">++</span><span class="token punctuation">)</span><span class="token punctuation">&#123;</span>
       t<span class="token punctuation">[</span>s<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token operator">-</span><span class="token string">'0'</span><span class="token punctuation">]</span><span class="token operator">++</span><span class="token punctuation">;</span>
   <span class="token punctuation">&#125;</span>
   <span class="token keyword">for</span><span class="token punctuation">(</span><span class="token keyword">int</span> i<span class="token operator">=</span><span class="token number">1</span><span class="token punctuation">;</span>i<span class="token operator">&lt;</span><span class="token number">10</span><span class="token punctuation">;</span>i<span class="token operator">++</span><span class="token punctuation">)</span><span class="token punctuation">&#123;</span>
       <span class="token keyword">if</span><span class="token punctuation">(</span>t<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token operator">%</span>i<span class="token operator">==</span><span class="token number">0</span><span class="token operator">&amp;&amp;</span>t<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">&#123;</span>
           <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"%d "</span><span class="token punctuation">,</span>i<span class="token punctuation">)</span><span class="token punctuation">;</span>
       <span class="token punctuation">&#125;</span>
   <span class="token punctuation">&#125;</span>
   <span class="token keyword">return</span> <span class="token number">0</span><span class="token punctuation">;</span>
<span class="token punctuation">&#125;</span><span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></code></pre>

<h2 id="在等待一杯香甜的牛奶"><a href="#在等待一杯香甜的牛奶" class="headerlink" title="在等待一杯香甜的牛奶"></a>在等待一杯香甜的牛奶</h2><p><strong>题目描述</strong><br>身高只有1米5的a喜欢喝牛奶，因为想长高。<br>但是这次的故事和a没有关系。<br>b小姐会从一些农场中定期采购牛奶，并且每个农场的奶价是不一样的，每天每个农场也只能提供一定数量的牛奶。<br>b小姐每天都有一个对牛奶的需求量，她想知道这一天她最少需要花多少钱才能满足自己（保证总产量大于需求量）。</p>
<p><strong>输入格式</strong><br>第一行两个整数n,m(1&lt;=n&lt;=2*10^6,1&lt;=m&lt;=5000)，表示需要牛奶的数量和农场的数量。<br>接下来m行，每行两个整数w,q(1&lt;=w&lt;=10^3,1&lt;=q&lt;=10^6)，表示第i间农场奶的单价和提供奶的数量。</p>
<p><strong>输出格式</strong><br>一行一个整数，表示最小费用。</p>
<p><strong>思路</strong><br>一定要读好题再写- -，我没读明白题直接敲代码，导致以为单价是总价，没啥好说的，就一个结构体排序，然后判断当前q是不是已经超过n了，如果没超过，相乘求和，n-当前q；如果超过了，n*w，输出。</p>
<p>我们伟大的人形和炮姐又给了一个新的思想：桶排</p>
<p><strong>code</strong></p>
<pre class="line-numbers language-cpp" data-language="cpp"><code class="language-cpp"><span class="token keyword">struct</span> <span class="token class-name">st</span>
<span class="token punctuation">&#123;</span>
    <span class="token keyword">double</span> w<span class="token punctuation">,</span>q<span class="token punctuation">;</span>
<span class="token punctuation">&#125;</span>s<span class="token punctuation">[</span><span class="token number">5005</span><span class="token punctuation">]</span><span class="token punctuation">;</span>
<span class="token keyword">bool</span> <span class="token function">cmp</span><span class="token punctuation">(</span>st a<span class="token punctuation">,</span>st b<span class="token punctuation">)</span><span class="token punctuation">&#123;</span>
    <span class="token keyword">return</span> a<span class="token punctuation">.</span>w<span class="token operator">&lt;</span>b<span class="token punctuation">.</span>w<span class="token punctuation">;</span>
<span class="token punctuation">&#125;</span>

<span class="token keyword">int</span> <span class="token function">main</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">&#123;</span>
    <span class="token keyword">int</span> n<span class="token punctuation">,</span>m<span class="token punctuation">;</span>
    <span class="token keyword">int</span> ans<span class="token operator">=</span><span class="token number">0</span><span class="token punctuation">;</span>
    cin<span class="token operator">>></span>n<span class="token operator">>></span>m<span class="token punctuation">;</span>
    <span class="token keyword">for</span><span class="token punctuation">(</span><span class="token keyword">int</span> i<span class="token operator">=</span><span class="token number">0</span><span class="token punctuation">;</span>i<span class="token operator">&lt;</span>m<span class="token punctuation">;</span>i<span class="token operator">++</span><span class="token punctuation">)</span> cin<span class="token operator">>></span>s<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">.</span>w<span class="token operator">>></span>s<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">.</span>q<span class="token punctuation">;</span>
    <span class="token function">sort</span><span class="token punctuation">(</span>s<span class="token punctuation">,</span>s<span class="token operator">+</span>m<span class="token punctuation">,</span>cmp<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token comment">//for(int i=0;i&lt;m;i++) cout&lt;&lt;s[i].w&lt;&lt;" "&lt;&lt;s[i].q&lt;&lt;endl;</span>
    <span class="token keyword">for</span><span class="token punctuation">(</span><span class="token keyword">int</span> j<span class="token operator">=</span><span class="token number">0</span><span class="token punctuation">;</span><span class="token punctuation">;</span>j<span class="token operator">++</span><span class="token punctuation">)</span><span class="token punctuation">&#123;</span>
        <span class="token keyword">if</span><span class="token punctuation">(</span>s<span class="token punctuation">[</span>j<span class="token punctuation">]</span><span class="token punctuation">.</span>q<span class="token operator">></span>n<span class="token punctuation">)</span><span class="token punctuation">&#123;</span>
            ans<span class="token operator">+=</span>n<span class="token operator">*</span>s<span class="token punctuation">[</span>j<span class="token punctuation">]</span><span class="token punctuation">.</span>w<span class="token punctuation">;</span>
            <span class="token keyword">break</span><span class="token punctuation">;</span>
        <span class="token punctuation">&#125;</span>
        n<span class="token operator">-=</span>s<span class="token punctuation">[</span>j<span class="token punctuation">]</span><span class="token punctuation">.</span>q<span class="token punctuation">;</span>
        ans<span class="token operator">+=</span>s<span class="token punctuation">[</span>j<span class="token punctuation">]</span><span class="token punctuation">.</span>q<span class="token operator">*</span>s<span class="token punctuation">[</span>j<span class="token punctuation">]</span><span class="token punctuation">.</span>w<span class="token punctuation">;</span>
        <span class="token comment">//cout&lt;&lt;ans&lt;&lt;endl;</span>
        <span class="token keyword">if</span><span class="token punctuation">(</span>n<span class="token operator">==</span><span class="token number">0</span><span class="token punctuation">)</span> <span class="token keyword">break</span><span class="token punctuation">;</span>
    <span class="token punctuation">&#125;</span>
    cout<span class="token operator">&lt;&lt;</span>ans<span class="token operator">&lt;&lt;</span>endl<span class="token punctuation">;</span>
<span class="token punctuation">&#125;</span>


<span class="token comment">//桶排思想</span>
<span class="token keyword">int</span> t<span class="token punctuation">[</span><span class="token number">5005</span><span class="token punctuation">]</span><span class="token operator">=</span><span class="token punctuation">&#123;</span><span class="token number">0</span><span class="token punctuation">&#125;</span><span class="token punctuation">;</span>
<span class="token keyword">int</span> <span class="token function">main</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">&#123;</span>
    <span class="token keyword">int</span> n<span class="token punctuation">,</span>m<span class="token punctuation">;</span>
    <span class="token keyword">int</span> w<span class="token punctuation">,</span>q<span class="token punctuation">;</span>
    <span class="token keyword">int</span> ans<span class="token operator">=</span><span class="token number">0</span><span class="token punctuation">;</span>
    cin<span class="token operator">>></span>n<span class="token operator">>></span>m<span class="token punctuation">;</span>
    <span class="token keyword">while</span><span class="token punctuation">(</span>m<span class="token operator">--</span><span class="token punctuation">)</span><span class="token punctuation">&#123;</span>
        cin<span class="token operator">>></span>w<span class="token operator">>></span>q<span class="token punctuation">;</span>
        t<span class="token punctuation">[</span>w<span class="token punctuation">]</span><span class="token operator">+=</span>q<span class="token punctuation">;</span>
    <span class="token punctuation">&#125;</span>
    <span class="token keyword">for</span><span class="token punctuation">(</span><span class="token keyword">int</span> i<span class="token operator">=</span><span class="token number">1</span><span class="token punctuation">;</span><span class="token punctuation">;</span>i<span class="token operator">++</span><span class="token punctuation">)</span><span class="token punctuation">&#123;</span>
        <span class="token keyword">if</span><span class="token punctuation">(</span>t<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token operator">></span>n<span class="token punctuation">)</span><span class="token punctuation">&#123;</span>
            ans<span class="token operator">+=</span>n<span class="token operator">*</span>i<span class="token punctuation">;</span>
            <span class="token keyword">break</span><span class="token punctuation">;</span>
        <span class="token punctuation">&#125;</span>
        n<span class="token operator">-=</span>t<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">;</span>
        ans<span class="token operator">+=</span>t<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token operator">*</span>i<span class="token punctuation">;</span>
    <span class="token punctuation">&#125;</span>
    cout<span class="token operator">&lt;&lt;</span>ans<span class="token operator">&lt;&lt;</span>endl<span class="token punctuation">;</span>
<span class="token punctuation">&#125;</span><span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></code></pre>

<h2 id="那一定是灾难对吧"><a href="#那一定是灾难对吧" class="headerlink" title="那一定是灾难对吧"></a>那一定是灾难对吧</h2><p><strong>题目描述</strong><br>我们的蒟蒻魔术师小姐 h 做了个美梦，梦到自己有了一大笔钱，醒来之后却发现只是个梦，还要继续面对现实。<br>她又要帮助极东魔术协会统计今年得奖的人并帮忙发放奖励了。</p>
<ul>
<li>G：奖励 8000G，要求：普通魔术师魔术水平全国统一测试（下称魔考）成绩高于 80 分，且击杀一名及以上魔术杀手。</li>
<li>B：奖励 4000G，要求：魔考 85 分以上，且协会评测成绩 80 分以上。</li>
<li>P：奖励 2000G，要求：魔考 90 分以上，且协会评测成绩 70 分以上。</li>
<li>F：奖励 1000G，要求：魔考 85 分以上。</li>
<li>C：奖励 850G，要求：协会评测 85 分以上且在协会内任职。</li>
</ul>
<p>只要符合条件就可以获得对应的奖励，每位魔术师可获得多个不同的奖励。题目保证一定会有人获得奖励。<br>现给出多名魔术师的数据，请帮助忙碌的 h 小姐完成工作。</p>
<p><strong>输入格式</strong><br>第一行一个整数n(1&lt;=n&lt;=1000) ，表示魔术师总数。<br>接下来n行，每行从左到右依次为姓名，魔考成绩，协会评测成绩，是否在协会内任职，及击杀魔术杀手数量。其中，姓名为仅由大小写英文字母组成的长度不超过 20 的字符串；魔考成绩与协会评测成绩为 0 至 100 之间的任意整数；是否在协会内任职由单个字符表示，Y为是，N为不是；击杀数量为 0 至 10 之间的任意整数。</p>
<p><strong>输出格式</strong><br>第一行是获得奖金最多的魔术师姓名，若获奖者为 Hibiki 则在本行姓名后额外输出Hibiki txdy!（以空格分隔）。<br>第二行是该魔术师所获得的奖金数量。<br>第三行是所有魔术师获得的总奖金数量。<br>（注：若奖金最多者出现多位，则输出第一次出现的魔术师。）</p>
<p><strong>思路</strong><br>结构体的加减法，直接码！</p>
<p><strong>code</strong></p>
<pre class="line-numbers language-cpp" data-language="cpp"><code class="language-cpp"><span class="token keyword">struct</span> <span class="token class-name">st</span>
<span class="token punctuation">&#123;</span>
    <span class="token keyword">char</span> s<span class="token punctuation">[</span><span class="token number">25</span><span class="token punctuation">]</span><span class="token punctuation">;</span>
    <span class="token keyword">int</span> mk<span class="token punctuation">,</span>xh<span class="token punctuation">;</span>
    <span class="token keyword">char</span> rz<span class="token punctuation">[</span><span class="token number">5</span><span class="token punctuation">]</span><span class="token punctuation">;</span>
    <span class="token keyword">int</span> js<span class="token punctuation">;</span>
    <span class="token keyword">int</span> all<span class="token punctuation">;</span>
<span class="token punctuation">&#125;</span>s<span class="token punctuation">[</span><span class="token number">1005</span><span class="token punctuation">]</span><span class="token punctuation">;</span>


<span class="token keyword">int</span> <span class="token function">main</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">&#123;</span>
    <span class="token keyword">int</span> n<span class="token punctuation">;</span>
    <span class="token keyword">int</span> ans<span class="token operator">=</span><span class="token number">0</span><span class="token punctuation">,</span>ansi<span class="token operator">=</span><span class="token number">0</span><span class="token punctuation">;</span>
    <span class="token keyword">long</span> <span class="token keyword">long</span> all<span class="token operator">=</span><span class="token number">0</span><span class="token punctuation">;</span>
    cin<span class="token operator">>></span>n<span class="token punctuation">;</span>
    <span class="token keyword">for</span><span class="token punctuation">(</span><span class="token keyword">int</span> i<span class="token operator">=</span><span class="token number">0</span><span class="token punctuation">;</span>i<span class="token operator">&lt;</span>n<span class="token punctuation">;</span>i<span class="token operator">++</span><span class="token punctuation">)</span><span class="token punctuation">&#123;</span>
        cin<span class="token operator">>></span>s<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">.</span>s<span class="token operator">>></span>s<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">.</span>mk<span class="token operator">>></span>s<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">.</span>xh<span class="token operator">>></span>s<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">.</span>rz<span class="token operator">>></span>s<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">.</span>js<span class="token punctuation">;</span>
        s<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">.</span>all<span class="token operator">=</span><span class="token number">0</span><span class="token punctuation">;</span>
        <span class="token keyword">if</span><span class="token punctuation">(</span>s<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">.</span>mk<span class="token operator">></span><span class="token number">80</span><span class="token operator">&amp;&amp;</span>s<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">.</span>js<span class="token operator">!=</span><span class="token number">0</span><span class="token punctuation">)</span> s<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">.</span>all<span class="token operator">+=</span><span class="token number">8000</span><span class="token punctuation">;</span>
        <span class="token keyword">if</span><span class="token punctuation">(</span>s<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">.</span>mk<span class="token operator">></span><span class="token number">85</span><span class="token operator">&amp;&amp;</span>s<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">.</span>xh<span class="token operator">></span><span class="token number">80</span><span class="token punctuation">)</span> s<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">.</span>all<span class="token operator">+=</span><span class="token number">4000</span><span class="token punctuation">;</span>
        <span class="token keyword">if</span><span class="token punctuation">(</span>s<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">.</span>mk<span class="token operator">></span><span class="token number">90</span><span class="token operator">&amp;&amp;</span>s<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">.</span>xh<span class="token operator">></span><span class="token number">70</span><span class="token punctuation">)</span> s<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">.</span>all<span class="token operator">+=</span><span class="token number">2000</span><span class="token punctuation">;</span>
        <span class="token keyword">if</span><span class="token punctuation">(</span>s<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">.</span>mk<span class="token operator">></span><span class="token number">85</span><span class="token punctuation">)</span> s<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">.</span>all<span class="token operator">+=</span><span class="token number">1000</span><span class="token punctuation">;</span>
        <span class="token keyword">if</span><span class="token punctuation">(</span>s<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">.</span>xh<span class="token operator">></span><span class="token number">85</span><span class="token operator">&amp;&amp;</span>s<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">.</span>rz<span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">]</span><span class="token operator">==</span><span class="token string">'Y'</span><span class="token punctuation">)</span> s<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">.</span>all<span class="token operator">+=</span><span class="token number">850</span><span class="token punctuation">;</span>
        <span class="token keyword">if</span><span class="token punctuation">(</span>s<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">.</span>all<span class="token operator">></span>ans<span class="token punctuation">)</span><span class="token punctuation">&#123;</span>
            ans<span class="token operator">=</span>s<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">.</span>all<span class="token punctuation">;</span>
            ansi<span class="token operator">=</span>i<span class="token punctuation">;</span>
        <span class="token punctuation">&#125;</span>
        all<span class="token operator">+=</span>s<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">.</span>all<span class="token punctuation">;</span>
    <span class="token punctuation">&#125;</span>
    cout<span class="token operator">&lt;&lt;</span>s<span class="token punctuation">[</span>ansi<span class="token punctuation">]</span><span class="token punctuation">.</span>s<span class="token punctuation">;</span>
    <span class="token keyword">if</span><span class="token punctuation">(</span><span class="token function">strcmp</span><span class="token punctuation">(</span>s<span class="token punctuation">[</span>ansi<span class="token punctuation">]</span><span class="token punctuation">.</span>s<span class="token punctuation">,</span><span class="token string">"Hibiki"</span><span class="token punctuation">)</span><span class="token operator">==</span><span class="token number">0</span><span class="token punctuation">)</span> cout<span class="token operator">&lt;&lt;</span><span class="token string">" "</span><span class="token operator">&lt;&lt;</span><span class="token string">"Hibiki"</span><span class="token operator">&lt;&lt;</span><span class="token string">" "</span><span class="token operator">&lt;&lt;</span><span class="token string">"txdy!"</span><span class="token punctuation">;</span>
    cout<span class="token operator">&lt;&lt;</span>endl<span class="token punctuation">;</span>
    cout<span class="token operator">&lt;&lt;</span>s<span class="token punctuation">[</span>ansi<span class="token punctuation">]</span><span class="token punctuation">.</span>all<span class="token operator">&lt;&lt;</span>endl<span class="token punctuation">;</span>
    cout<span class="token operator">&lt;&lt;</span>all<span class="token operator">&lt;&lt;</span>endl<span class="token punctuation">;</span>
<span class="token punctuation">&#125;</span><span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></code></pre>

<h2 id="在无限延伸的梦想后面"><a href="#在无限延伸的梦想后面" class="headerlink" title="在无限延伸的梦想后面"></a>在无限延伸的梦想后面</h2><p><strong>题目描述</strong><br>h 最近在玩一个经营模拟游戏，现在她有 n 件物品需要排队等待制造。<br>这 n 件物品按照制造顺序从 1 到 n 编号，每件物品都有一个制造消耗的时间 。<br>一共有 m 座制造站，单个制造站每次只能制造一件物品。<br>开始制造时，1 到 m 号物品分别占据一个制造站，同时开始制造，当某件物品完成制造时，会立即有下一件物品顶替该物品的位置开始制造（某件物品 t 秒制造完时，下一件物品会从 t+1 秒开始制造）。<br>h 特别菜，所以她想问问你这些物品按顺序制造需要多久才能制造完。</p>
<p><strong>输入格式</strong><br>第一行两个整数 n,m(1&lt;=m&lt;=100,1&lt;=n&lt;=10000 且 m&lt;=n)，分别表示物品数与制造站数。<br>接下来一行有 n 个整数，第 i 个数字 t(1&lt;=t&lt;=100) 表示第 i 件物品需要花费的制造时间。</p>
<p><strong>输出格式</strong><br>一行一个整数，表示制造所有物品需要花费的时间。</p>
<p><strong>思路</strong><br>这题不应该在这个位置的，只是我想多了，我刚开始想的是：</p>
<p><img  srcset="data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20300%20300'%3E%3C/svg%3E" data-src="https://api2.mubu.com/v3/document_image/cb51dc03-795e-449c-8bf3-14ff49f80f44-3807603.jpg" class="lozad post-image"src="https://api2.mubu.com/v3/document_image/cb51dc03-795e-449c-8bf3-14ff49f80f44-3807603.jpg"></p>
<p>然后我想先用sort试一下，写的是下边这个，今天问完人形，人形跟我说的是这个：</p>
<p><img  srcset="data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20300%20300'%3E%3C/svg%3E" data-src="https://api2.mubu.com/v3/document_image/8e5ca74a-81fe-4f5d-953a-a947ebbd5dfd-3807603.jpg" class="lozad post-image"src="https://api2.mubu.com/v3/document_image/8e5ca74a-81fe-4f5d-953a-a947ebbd5dfd-3807603.jpg"></p>
<p><img  srcset="data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20300%20300'%3E%3C/svg%3E" data-src="https://api2.mubu.com/v3/document_image/801e110a-d3f9-4e45-996d-8911d622d9f4-3807603.jpg" class="lozad post-image"src="https://api2.mubu.com/v3/document_image/801e110a-d3f9-4e45-996d-8911d622d9f4-3807603.jpg"></p>
<p><img  srcset="data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20300%20300'%3E%3C/svg%3E" data-src="https://api2.mubu.com/v3/document_image/413603e0-869d-4718-a0dd-da2458e77764-3807603.jpg" class="lozad post-image"src="https://api2.mubu.com/v3/document_image/413603e0-869d-4718-a0dd-da2458e77764-3807603.jpg"></p>
<p>然后我：</p>
<p><img  srcset="data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20300%20300'%3E%3C/svg%3E" data-src="https://api2.mubu.com/v3/document_image/57b98f94-c1aa-417f-819f-d4c236321815-3807603.jpg" class="lozad post-image"src="https://api2.mubu.com/v3/document_image/57b98f94-c1aa-417f-819f-d4c236321815-3807603.jpg"></p>
<p>草！（一种植物）</p>
<p><strong>code</strong></p>
<pre class="line-numbers language-cpp" data-language="cpp"><code class="language-cpp"><span class="token keyword">int</span> <span class="token function">main</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
<span class="token punctuation">&#123;</span>
    <span class="token keyword">int</span> m<span class="token punctuation">,</span>n<span class="token punctuation">,</span>x<span class="token punctuation">,</span>j<span class="token operator">=</span><span class="token number">0</span><span class="token punctuation">;</span>
    <span class="token keyword">int</span> ans<span class="token operator">=</span><span class="token number">0</span><span class="token punctuation">;</span>
    <span class="token keyword">int</span> t<span class="token punctuation">[</span><span class="token number">10005</span><span class="token punctuation">]</span><span class="token punctuation">;</span>
    <span class="token keyword">int</span> tm<span class="token punctuation">[</span><span class="token number">105</span><span class="token punctuation">]</span><span class="token punctuation">;</span>
    cin<span class="token operator">>></span>n<span class="token operator">>></span>m<span class="token punctuation">;</span>
    <span class="token keyword">for</span><span class="token punctuation">(</span><span class="token keyword">int</span> i<span class="token operator">=</span><span class="token number">0</span><span class="token punctuation">;</span>i<span class="token operator">&lt;</span>n<span class="token punctuation">;</span>i<span class="token operator">++</span><span class="token punctuation">)</span><span class="token punctuation">&#123;</span>
        cin<span class="token operator">>></span>x<span class="token punctuation">;</span>
        <span class="token keyword">if</span><span class="token punctuation">(</span>j<span class="token operator">!=</span>m<span class="token punctuation">)</span> tm<span class="token punctuation">[</span>j<span class="token operator">++</span><span class="token punctuation">]</span><span class="token operator">=</span>x<span class="token punctuation">;</span>
        <span class="token keyword">else</span> <span class="token punctuation">&#123;</span>
            <span class="token function">sort</span><span class="token punctuation">(</span>tm<span class="token punctuation">,</span>tm<span class="token operator">+</span>j<span class="token punctuation">)</span><span class="token punctuation">;</span>
            tm<span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">]</span><span class="token operator">+=</span>x<span class="token punctuation">;</span>
        <span class="token punctuation">&#125;</span>
    <span class="token punctuation">&#125;</span>
    <span class="token function">sort</span><span class="token punctuation">(</span>tm<span class="token punctuation">,</span>tm<span class="token operator">+</span>j<span class="token punctuation">)</span><span class="token punctuation">;</span>
    cout<span class="token operator">&lt;&lt;</span>tm<span class="token punctuation">[</span>j<span class="token operator">-</span><span class="token number">1</span><span class="token punctuation">]</span><span class="token operator">&lt;&lt;</span>endl<span class="token punctuation">;</span>
<span class="token punctuation">&#125;</span><span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></code></pre>

<h2 id="把奇迹聚集起来"><a href="#把奇迹聚集起来" class="headerlink" title="把奇迹聚集起来"></a>把奇迹聚集起来</h2><p><strong>题目描述</strong><br>众所周知，h 喜欢打游戏。最近 h 玩了一堆奇奇怪怪的小 RPG。<br>这天晚上她做了梦，梦到她在挑战一个魔王，但是魔王实在是太强大啦，菜如 h 根本打不过。<br>也不知道为什么，h 发现自己有一个特殊的机制叫做奇迹。<br>想要引发奇迹，就要填满奇迹槽，奇迹槽可以被划分成连续的 n 段，每段奇迹槽初始值都为0。每段所需要的奇迹值都不同，第 i 段奇迹槽所需要的奇迹值为 ki。拥有的奇迹值必须恰好等于 ki 才可以引发奇迹。<br>h 每次可以选择一个连续区间[L,R] ，使这段区间内的奇迹值增加1 。<br>h 胆小又菜，她想知道消灭魔王最少需要多少次操作。</p>
<p><strong>输入格式</strong><br>第一行，一个整数 n(1&lt;=n&lt;=10^5)，表示奇迹槽的划分。<br>第二行，n 个数，第 i 个数字表示 ki(1&lt;=ki&lt;=10^4)。</p>
<p><strong>输出格式</strong><br>一行，一个整数，表示最少需要操作多少次。</p>
<p><strong>思路</strong><br>这题不难，主要看能不能想通，我当时就没想通，太菜了呜呜呜，我们只需要比较当前值与下一个值，如果下一个值小于当前值，那么我在完成当前值的时候，下一个值必能满足，也就是说不用更新ans，如果当前值小于下一个值，ans要加上差值，遍历一遍数组就是答案~</p>
<p><strong>code</strong></p>
<pre class="line-numbers language-cpp" data-language="cpp"><code class="language-cpp"><span class="token keyword">int</span> <span class="token function">main</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">&#123;</span>
    <span class="token keyword">int</span> n<span class="token punctuation">,</span>x<span class="token punctuation">;</span>
    <span class="token keyword">int</span> ans<span class="token operator">=</span><span class="token number">0</span><span class="token punctuation">,</span>now<span class="token operator">=</span><span class="token number">0</span><span class="token punctuation">;</span>
    cin<span class="token operator">>></span>n<span class="token punctuation">;</span>
    <span class="token keyword">while</span><span class="token punctuation">(</span>n<span class="token operator">--</span><span class="token punctuation">)</span><span class="token punctuation">&#123;</span>
        cin<span class="token operator">>></span>x<span class="token punctuation">;</span>
        <span class="token keyword">if</span><span class="token punctuation">(</span>x<span class="token operator">></span>now<span class="token punctuation">)</span> ans<span class="token operator">+=</span>x<span class="token operator">-</span>now<span class="token punctuation">;</span>
        now<span class="token operator">=</span>x<span class="token punctuation">;</span>
    <span class="token punctuation">&#125;</span>
    cout<span class="token operator">&lt;&lt;</span>ans<span class="token operator">&lt;&lt;</span>endl<span class="token punctuation">;</span>
<span class="token punctuation">&#125;</span><span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></code></pre>

<h2 id="许个愿望也许希望就会降临"><a href="#许个愿望也许希望就会降临" class="headerlink" title="许个愿望也许希望就会降临"></a>许个愿望也许希望就会降临</h2><p><strong>题目描述</strong><br>止雨许了个愿望，想要吃比利时黑巧云朵蛋挞，人形决定满足她的愿望。<br>因为异世界没有KFC ，所以人形找到了魔法师h ，但是众所周知，h 很蒻，需要别人的帮助才能使用魔法。<br>h 有 n 个魔法球，编号 1 到 n，每个魔法球都有一个魔法值w 。<br>现在 h 需要执行 m 次操作来完成魔法，每次操作有如下两种：</p>
<ul>
<li>f x y表示查询编号 x 到 y 的魔球中的最大魔法值。</li>
<li>m x k表示把编号为 x 的魔球的魔法值变为 。</li>
</ul>
<p>现在人形要帮助 h 来完成这次魔法的过程，但是人形睡着了，所以希望你来帮助她实现这个过程。</p>
<p><strong>输入格式</strong><br>第一行两个整数 ，分别表示魔法球数目和魔法需要操作的次数。<br>第二行 n 个数，第 i 个数表示第 i 个魔球的魔法值 wi(1&lt;=wi&lt;=10^4)。<br>接下来 m 行，每行一条指令，格式如题目描述所示(1&lt;=x&lt;=y&lt;=n,1&lt;=k&lt;=10^4)。</p>
<p><strong>输出格式</strong><br>对于每条查询操作，输出一行一个数字，表示查询结果。</p>
<p><strong>思路</strong><br>刚才有个朋友问我wls发生什么事了，我说怎么回事，给我发了一道题。我一看!嗷!原来是昨天，校队选拔赛，我想玩玩，啪就点进去许个愿望也许希望就会降临，很快啊!一看，线段树裸题，不码，直接放弃。<br>结果今天人形：</p>
<p><img  srcset="data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20300%20300'%3E%3C/svg%3E" data-src="https://api2.mubu.com/v3/document_image/df6b2337-c9f6-463e-ba52-04e822575dbb-3807603.jpg" class="lozad post-image"src="https://api2.mubu.com/v3/document_image/df6b2337-c9f6-463e-ba52-04e822575dbb-3807603.jpg"></p>
<p>砸键盘.gif</p>
<p>既然暴力可以过，他怎么要求的就怎么写就行，但是在这里还是建议大家学一下树状数组和线段树~</p>
<p><strong>code</strong></p>
<pre class="line-numbers language-cpp" data-language="cpp"><code class="language-cpp"><span class="token keyword">int</span> t<span class="token punctuation">[</span><span class="token number">200005</span><span class="token punctuation">]</span><span class="token punctuation">;</span>
<span class="token keyword">int</span> <span class="token function">main</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">&#123;</span>
    <span class="token keyword">int</span> n<span class="token punctuation">,</span>m<span class="token punctuation">;</span>
    <span class="token keyword">int</span> x<span class="token punctuation">,</span>y<span class="token punctuation">;</span>
    <span class="token keyword">int</span> ans<span class="token punctuation">;</span>
    <span class="token function">scanf</span><span class="token punctuation">(</span><span class="token string">"%d%d"</span><span class="token punctuation">,</span><span class="token operator">&amp;</span>n<span class="token punctuation">,</span><span class="token operator">&amp;</span>m<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">for</span><span class="token punctuation">(</span><span class="token keyword">int</span> i<span class="token operator">=</span><span class="token number">0</span><span class="token punctuation">;</span>i<span class="token operator">&lt;</span>n<span class="token punctuation">;</span>i<span class="token operator">++</span><span class="token punctuation">)</span> <span class="token function">scanf</span><span class="token punctuation">(</span><span class="token string">"%d"</span><span class="token punctuation">,</span><span class="token operator">&amp;</span>t<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">while</span><span class="token punctuation">(</span>m<span class="token operator">--</span><span class="token punctuation">)</span><span class="token punctuation">&#123;</span>
    	<span class="token keyword">char</span> qs<span class="token punctuation">[</span><span class="token number">3</span><span class="token punctuation">]</span><span class="token punctuation">;</span>
        <span class="token function">scanf</span><span class="token punctuation">(</span><span class="token string">"%s %d %d"</span><span class="token punctuation">,</span>qs<span class="token punctuation">,</span><span class="token operator">&amp;</span>x<span class="token punctuation">,</span><span class="token operator">&amp;</span>y<span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">if</span><span class="token punctuation">(</span>qs<span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">]</span><span class="token operator">==</span><span class="token string">'f'</span><span class="token punctuation">)</span><span class="token punctuation">&#123;</span>
            ans<span class="token operator">=</span><span class="token number">0</span><span class="token punctuation">;</span>
            <span class="token keyword">for</span><span class="token punctuation">(</span><span class="token keyword">int</span> i<span class="token operator">=</span>x<span class="token operator">-</span><span class="token number">1</span><span class="token punctuation">;</span>i<span class="token operator">&lt;</span>y<span class="token punctuation">;</span>i<span class="token operator">++</span><span class="token punctuation">)</span><span class="token punctuation">&#123;</span>
                <span class="token keyword">if</span><span class="token punctuation">(</span>t<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token operator">></span>ans<span class="token punctuation">)</span> ans<span class="token operator">=</span>t<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">;</span>
            <span class="token punctuation">&#125;</span>
            <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"%d\n"</span><span class="token punctuation">,</span>ans<span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token punctuation">&#125;</span>
        <span class="token keyword">else</span> <span class="token keyword">if</span><span class="token punctuation">(</span>qs<span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">]</span><span class="token operator">==</span><span class="token string">'m'</span><span class="token punctuation">)</span><span class="token punctuation">&#123;</span>
            t<span class="token punctuation">[</span>x<span class="token operator">-</span><span class="token number">1</span><span class="token punctuation">]</span><span class="token operator">=</span>y<span class="token punctuation">;</span>
        <span class="token punctuation">&#125;</span>
    <span class="token punctuation">&#125;</span>
    <span class="token keyword">return</span> <span class="token number">0</span><span class="token punctuation">;</span> 
<span class="token punctuation">&#125;</span><span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></code></pre>
  </div>
  <div>
    
  </div>
</article>
<div class="nav">
  
    <div class="nav-item-prev">
      <a 
        href="/2021/06/13/SetTimeoutPromiseAsyncAwait/" 
        class="nav-link">
        <i class="iconfont icon-left nav-prev-icon"></i>
        <div>
          <div class="nav-label">上一篇</div>
          
            <div class="nav-title">setTimeout,promise,async await的区别 </div>
          
        </div>
      </a>
    </div>
  
  
    <div class="nav-item-next">
      <a 
        href="/2021/06/13/requestImplementation/" 
        class="nav-link">
        <div>
          <div class="nav-label">下一篇</div>
          
            <div class="nav-title">js之Promise封装nodejs的request实现 </div>
          
        </div>
        <i class="iconfont icon-right nav-next-icon"></i>
      </a>
    </div>
  
</div>

<div 
  class="card card-content toc-card" 
  id="mobiletoc">
  <div class="toc-header">
  <i 
    class="iconfont icon-menu" 
    style="padding-right: 2px;">
  </i>目录
</div>
<ol class="toc"><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%89%8D%E8%A8%80"><span class="toc-text">前言</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#ACM-make-it-possible"><span class="toc-text">ACM, make it possible!</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%88%90%E4%B8%BA%E6%83%B3%E8%A6%81%E6%88%90%E4%B8%BA%E7%9A%84%E7%8C%AB"><span class="toc-text">成为想要成为的猫</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%9C%A8%E7%AD%89%E5%BE%85%E4%B8%80%E6%9D%AF%E9%A6%99%E7%94%9C%E7%9A%84%E7%89%9B%E5%A5%B6"><span class="toc-text">在等待一杯香甜的牛奶</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E9%82%A3%E4%B8%80%E5%AE%9A%E6%98%AF%E7%81%BE%E9%9A%BE%E5%AF%B9%E5%90%A7"><span class="toc-text">那一定是灾难对吧</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%9C%A8%E6%97%A0%E9%99%90%E5%BB%B6%E4%BC%B8%E7%9A%84%E6%A2%A6%E6%83%B3%E5%90%8E%E9%9D%A2"><span class="toc-text">在无限延伸的梦想后面</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%8A%8A%E5%A5%87%E8%BF%B9%E8%81%9A%E9%9B%86%E8%B5%B7%E6%9D%A5"><span class="toc-text">把奇迹聚集起来</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E8%AE%B8%E4%B8%AA%E6%84%BF%E6%9C%9B%E4%B9%9F%E8%AE%B8%E5%B8%8C%E6%9C%9B%E5%B0%B1%E4%BC%9A%E9%99%8D%E4%B8%B4"><span class="toc-text">许个愿望也许希望就会降临</span></a></li></ol>
</div></main>
            <aside class="left-column">
              
              <div class="card card-author">
                
  <img 
    src="https://api2.mubu.com/v3/photo/654b368e-b847-4122-982c-86d90b3f5275.jpg" 
    class="author-img" 
    alt="author avatar">

<p class="author-name">霜序廿</p>
<p class="author-description">无限进步</p>
<div class="author-message">
  <a 
    class="author-posts-count" 
    href="/archives">
    <span>253</span>
    <span>文章</span>
  </a>
  <a 
    class="author-categories-count" 
    href="/categories">
    <span>6</span>
    <span>分类</span>
  </a>
  <a 
    class="author-tags-count" 
    href="/tags">
    <span>51</span>
    <span>标签</span>
  </a>
</div>

  <div class="author-card-society">
    
      <div class="author-card-society-icon">
        <a target="_blank" rel="noopener" href="https://github.com/shuangxunian">
          <i class="iconfont icon-github society-icon"></i>
        </a>
      </div>
    
      <div class="author-card-society-icon">
        <a target="_blank" rel="noopener" href="https://space.bilibili.com/391117803">
          <i class="iconfont icon-bilibili society-icon"></i>
        </a>
      </div>
    
  </div>

              </div>
               <div class="sticky-tablet">
  
  
    <article class="display-when-two-columns spacer">
      <div class="card card-content toc-card">
        <div class="toc-header">
  <i 
    class="iconfont icon-menu" 
    style="padding-right: 2px;">
  </i>目录
</div>
<ol class="toc"><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%89%8D%E8%A8%80"><span class="toc-text">前言</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#ACM-make-it-possible"><span class="toc-text">ACM, make it possible!</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%88%90%E4%B8%BA%E6%83%B3%E8%A6%81%E6%88%90%E4%B8%BA%E7%9A%84%E7%8C%AB"><span class="toc-text">成为想要成为的猫</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%9C%A8%E7%AD%89%E5%BE%85%E4%B8%80%E6%9D%AF%E9%A6%99%E7%94%9C%E7%9A%84%E7%89%9B%E5%A5%B6"><span class="toc-text">在等待一杯香甜的牛奶</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E9%82%A3%E4%B8%80%E5%AE%9A%E6%98%AF%E7%81%BE%E9%9A%BE%E5%AF%B9%E5%90%A7"><span class="toc-text">那一定是灾难对吧</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%9C%A8%E6%97%A0%E9%99%90%E5%BB%B6%E4%BC%B8%E7%9A%84%E6%A2%A6%E6%83%B3%E5%90%8E%E9%9D%A2"><span class="toc-text">在无限延伸的梦想后面</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%8A%8A%E5%A5%87%E8%BF%B9%E8%81%9A%E9%9B%86%E8%B5%B7%E6%9D%A5"><span class="toc-text">把奇迹聚集起来</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E8%AE%B8%E4%B8%AA%E6%84%BF%E6%9C%9B%E4%B9%9F%E8%AE%B8%E5%B8%8C%E6%9C%9B%E5%B0%B1%E4%BC%9A%E9%99%8D%E4%B8%B4"><span class="toc-text">许个愿望也许希望就会降临</span></a></li></ol>
      </div>
    </article>
  
  
  <article class="card card-content categories-widget">
    <div class="categories-card">
  <div class="categories-header">
    <i 
      class="iconfont icon-fenlei" 
      style="padding-right: 2px;">
    </i>分类
  </div>
  <div class="categories-list">
    
      <a href="/categories/%E6%8A%80%E6%9C%AF%E6%96%87%E7%AB%A0/">
        <div class="categories-list-item">
          技术文章
          <span class="categories-list-item-badge">218</span>
        </div>
      </a>
    
      <a href="/categories/%E5%85%B6%E4%BB%96/">
        <div class="categories-list-item">
          其他
          <span class="categories-list-item-badge">16</span>
        </div>
      </a>
    
      <a href="/categories/%E6%97%85%E6%B8%B8/">
        <div class="categories-list-item">
          旅游
          <span class="categories-list-item-badge">1</span>
        </div>
      </a>
    
      <a href="/categories/%E7%AE%97%E6%B3%95/">
        <div class="categories-list-item">
          算法
          <span class="categories-list-item-badge">8</span>
        </div>
      </a>
    
      <a href="/categories/%E8%80%83%E8%AF%95/">
        <div class="categories-list-item">
          考试
          <span class="categories-list-item-badge">8</span>
        </div>
      </a>
    
      <a href="/categories/%E9%98%85%E8%AF%BB/">
        <div class="categories-list-item">
          阅读
          <span class="categories-list-item-badge">1</span>
        </div>
      </a>
    
  </div>
</div>
  </article>
  
  <article class="card card-content tags-widget">
    <div class="tags-card">
  <div class="tags-header">
    <i 
      class="iconfont icon-biaoqian" 
      style="padding-right: 2px;">
    </i>热门标签
  </div>
  <div class="tags-list">
    
      <a 
        href="/tags/js/" 
        title="js">
        <div class="tags-list-item">js</div>
      </a>
    
      <a 
        href="/tags/vue/" 
        title="vue">
        <div class="tags-list-item">vue</div>
      </a>
    
      <a 
        href="/tags/%E9%9D%A2%E8%AF%95/" 
        title="面试">
        <div class="tags-list-item">面试</div>
      </a>
    
      <a 
        href="/tags/css/" 
        title="css">
        <div class="tags-list-item">css</div>
      </a>
    
      <a 
        href="/tags/%E7%BD%91%E7%BB%9C/" 
        title="网络">
        <div class="tags-list-item">网络</div>
      </a>
    
      <a 
        href="/tags/%E5%85%B6%E4%BB%96/" 
        title="其他">
        <div class="tags-list-item">其他</div>
      </a>
    
      <a 
        href="/tags/%E7%AE%97%E6%B3%95/" 
        title="算法">
        <div class="tags-list-item">算法</div>
      </a>
    
      <a 
        href="/tags/%E6%B5%8F%E8%A7%88%E5%99%A8/" 
        title="浏览器">
        <div class="tags-list-item">浏览器</div>
      </a>
    
      <a 
        href="/tags/html/" 
        title="html">
        <div class="tags-list-item">html</div>
      </a>
    
      <a 
        href="/tags/%E6%93%8D%E4%BD%9C%E7%B3%BB%E7%BB%9F/" 
        title="操作系统">
        <div class="tags-list-item">操作系统</div>
      </a>
    
      <a 
        href="/tags/%E8%80%83%E8%AF%95/" 
        title="考试">
        <div class="tags-list-item">考试</div>
      </a>
    
      <a 
        href="/tags/%E8%BD%AF%E5%AE%9E%E5%8A%9B/" 
        title="软实力">
        <div class="tags-list-item">软实力</div>
      </a>
    
      <a 
        href="/tags/DOM/" 
        title="DOM">
        <div class="tags-list-item">DOM</div>
      </a>
    
      <a 
        href="/tags/%E8%BD%AE%E5%AD%90/" 
        title="轮子">
        <div class="tags-list-item">轮子</div>
      </a>
    
      <a 
        href="/tags/%E7%BD%91%E7%BB%9C%E5%8E%9F%E7%90%86/" 
        title="网络原理">
        <div class="tags-list-item">网络原理</div>
      </a>
    
      <a 
        href="/tags/debug/" 
        title="debug">
        <div class="tags-list-item">debug</div>
      </a>
    
  </div>
</div>
  </article>
  
  
</div>
            </aside>
            <aside class="right-column">
              <div class="sticky-widescreen">
  
  
    <article class="card card-content toc-card">
      <div class="toc-header">
  <i 
    class="iconfont icon-menu" 
    style="padding-right: 2px;">
  </i>目录
</div>
<ol class="toc"><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%89%8D%E8%A8%80"><span class="toc-text">前言</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#ACM-make-it-possible"><span class="toc-text">ACM, make it possible!</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%88%90%E4%B8%BA%E6%83%B3%E8%A6%81%E6%88%90%E4%B8%BA%E7%9A%84%E7%8C%AB"><span class="toc-text">成为想要成为的猫</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%9C%A8%E7%AD%89%E5%BE%85%E4%B8%80%E6%9D%AF%E9%A6%99%E7%94%9C%E7%9A%84%E7%89%9B%E5%A5%B6"><span class="toc-text">在等待一杯香甜的牛奶</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E9%82%A3%E4%B8%80%E5%AE%9A%E6%98%AF%E7%81%BE%E9%9A%BE%E5%AF%B9%E5%90%A7"><span class="toc-text">那一定是灾难对吧</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%9C%A8%E6%97%A0%E9%99%90%E5%BB%B6%E4%BC%B8%E7%9A%84%E6%A2%A6%E6%83%B3%E5%90%8E%E9%9D%A2"><span class="toc-text">在无限延伸的梦想后面</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%8A%8A%E5%A5%87%E8%BF%B9%E8%81%9A%E9%9B%86%E8%B5%B7%E6%9D%A5"><span class="toc-text">把奇迹聚集起来</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E8%AE%B8%E4%B8%AA%E6%84%BF%E6%9C%9B%E4%B9%9F%E8%AE%B8%E5%B8%8C%E6%9C%9B%E5%B0%B1%E4%BC%9A%E9%99%8D%E4%B8%B4"><span class="toc-text">许个愿望也许希望就会降临</span></a></li></ol>
    </article>
  
  
  <article class="card card-content">
    <div class="recent-posts-card">
  <div class="recent-posts-header">
    <i 
      class="iconfont icon-wenzhang_huaban" 
      style="padding-right: 2px;">
    </i>最近文章
  </div>
  <div class="recent-posts-list">
    
      <div class="recent-posts-item">
        <div class="recent-posts-item-title">2022-05-01</div>
        <a href="/2022/05/01/typescriptHome/"><div class="recent-posts-item-content">typescript</div></a>
      </div>
    
      <div class="recent-posts-item">
        <div class="recent-posts-item-title">2022-01-15</div>
        <a href="/2022/01/15/javaScriptTheVariousWaysAndAdvantagesAndDisadvantagesOfDeepInheritance/"><div class="recent-posts-item-content">JavaScript深入之继承的多种方式和优缺点</div></a>
      </div>
    
      <div class="recent-posts-item">
        <div class="recent-posts-item-title">2022-01-15</div>
        <a href="/2022/01/15/javaScriptGoFromPrototypeToPrototypeChain/"><div class="recent-posts-item-content">JavaScript深入之从原型到原型链</div></a>
      </div>
    
      <div class="recent-posts-item">
        <div class="recent-posts-item-title">2022-01-15</div>
        <a href="/2022/01/15/javaScriptMemoryLeakTutorial/"><div class="recent-posts-item-content">JavaScript 内存泄漏教程</div></a>
      </div>
    
  </div>
</div>
  </article>
  
  
  
  <article class="card card-content">
    <div class="recent-posts-card">
  <div class="recent-posts-header">
    关注嘉然！顿顿解馋！
  </div>
  <div class="recent-posts-list">
    
      <img 
        src="https://api2.mubu.com/v3/document_image/2697c6ae-10ee-41a3-9099-304bdb252d31-3807603.jpg" 
        class="myadd-img" 
        alt="author avatar">
    
  </div>
</div>
  </article>
</div>
            </aside>
          </div>
        </div>
      </div>
    </div>
     
    <footer class="footer">
  <div class="footer-container">
    <div>
      <div class="footer-dsc">
        <span>
          Copyright ©
          
            2020 -
          
          2022
        </span>
        &nbsp;
        <a 
          href="/" 
          class="footer-link">
          霜序廿的个人网站
        </a>
      </div>
    </div>

    
      <div class="footer-dsc">
        
          Powered by
          <a 
            href="https://hexo.io/" 
            class="footer-link" 
            target="_blank" 
            rel="nofollow noopener noreferrer">
            &nbsp;Hexo
          </a>
        
        
          <span>&nbsp;|&nbsp;</span>
        
        
          Theme -
          <a 
            href="https://github.com/theme-kaze" 
            class="footer-link" 
            target="_blank"
            rel="nofollow noopener noreferrer">
            &nbsp;Kaze
          </a>
        
      </div>
    
    
    
    
</footer> 
    
  <a 
    role="button" 
    id="scrollbutton" 
    class="basebutton" 
    aria-label="回到顶部">
    <i class="iconfont icon-arrowleft button-icon"></i>
  </a>

<a 
  role="button" 
  id="menubutton" 
  class="basebutton">
  <i class="iconfont icon-menu button-icon"></i>
</a>
<a 
  role="button" 
  id="popbutton" 
  class="basebutton" 
  aria-label="控制中心">
  <i class="iconfont icon-expand button-icon"></i>
</a>
<a 
  role="button" 
  id="darkbutton" 
  class="basebutton darkwidget" 
  aria-label="夜色模式">
  <i class="iconfont icon-weather button-icon"></i>
</a>
<a 
  role="button" 
  id="searchbutton" 
  class="basebutton searchwidget" 
  aria-label="搜索">
  <i class="iconfont icon-search button-icon"></i>
</a> 
     
     
     
      <script>
  var addImgLayout = function () {
    var img = document.querySelectorAll('.post-content img')
    var i
    for (i = 0; i < img.length; i++) {
      var wrapper = document.createElement('a')
      wrapper.setAttribute('href', img[i].getAttribute('data-src'))
      wrapper.setAttribute('aria-label', 'illustration')
      wrapper.style.cssText =
        'width: 100%; display: flex; justify-content: center;'
      if (img[i].alt) wrapper.dataset.caption = img[i].alt
      wrapper.dataset.nolink = true
      img[i].before(wrapper)
      wrapper.append(img[i])
      var divWrap = document.createElement('div')
      divWrap.classList.add('gallery')
      wrapper.before(divWrap)
      divWrap.append(wrapper)
    }
    baguetteBox.run('.gallery')
  }
</script>
<script>
  loadScript(
    "/js/lib/lightbox/baguetteBox.min.js",
    addImgLayout
  )
</script>
 
     
     
    <script src="/js/main.js"></script> 
     
    
      <script>
        var addLazyload = function () {
          var observer = lozad('.lozad', {
            load: function (el) {
              el.srcset = el.getAttribute('data-src')
            },
            loaded: function (el) {
              el.classList.add('loaded')
            },
          })
          observer.observe()
        }
      </script>
      <script>
        loadScript('/js/lib/lozad.min.js', addLazyload)
      </script>
     
    
    
  </body>
</html>
